# encoding: UTF-8
"""

@author = 李林名
@email = lishuai1199@qq.com
@create_time = 2022/11/10 17:41

"""

from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep

# 1.创建 WebDriver 对象
wd = webdriver.Chrome()

# 2.调用WebDriver 对象的get方法 可以让浏览器打开指定网址
wd.get('https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&rsv_idx=1&tn=baidu&wd=%E7%99%BE%E5%BA%A6%2C%E4%BD%A0%E5%93%AA%E9%87%8C%E6%9D%A5%E7%9A%84%E8%87%AA%E4%BF%A1%EF%BC%9F&fenlei=256&oq=12&rsv_pq=9e00d75f0002fc05&rsv_t=2cf5qbWZhl8n8dSrhZT6je%2F5EejK%2F%2BCfaPxBN0cRf%2B1Bxg3Gvc2kmuJFvFs&rqlang=cn&rsv_dl=tb&rsv_enter=1&rsv_btype=t&inputT=10291&rsv_sug3=33&rsv_sug1=24&rsv_sug7=100&rsv_sug2=0&rsv_sug4=14375')

# 3.获取'百度一下'元素,获取输入框里面的信息
element=wd.find_element(By.ID,'kw')
print(element.get_attribute("value"))
# print(element.get_attribute("innerText"))
# print(element.get_attribute("textContent"))

# 4. 8s后关闭程序
sleep(8)